--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test/run_tests.sh main (dac94b89) Text, 2.84 KB
T8b949e#!/bin/bash
T8b949e# nomadForum - a forum on the NomadNetwork
T8b949e# Copyright (C) 2023-2026 AutumnSpark1226
T8b949e#
T8b949e# This program is free software: you can redistribute it and/or modify
T8b949e# it under the terms of the GNU General Public License as published by
T8b949e# the Free Software Foundation, either version 3 of the License, or
T8b949e# (at your option) any later version.
T8b949e#
T8b949e# This program is distributed in the hope that it will be useful,
T8b949e# but WITHOUT ANY WARRANTY; without even the implied warranty of
T8b949e# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
T8b949e# GNU General Public License for more details.
T8b949e#
T8b949e# You should have received a copy of the GNU General Public License
T8b949e# along with this program. If not, see <https://www.gnu.org/licenses/>.
Tffa657cd Tff7b72$(dirname Te6edf3$0Tff7b72)
Tffa657cd Tff7b72$(dirname Tff7b72$(Tffa657pwdTff7b72)Tff7b72)
Tffa657echo Setting up Tffa657test environment...
Te6edf3FAIL_COUNTTff7b72=T79c0ff0
T8b949e# yes, this name is long
env python3 -m venv virtual_environment_nomadForum_tests
Tffa657source ./virtual_environment_nomadForum_tests/bin/activate
Tffa657echo Installing dependencies...
pip install -r requirements.txt
Tffa657export Te6edf3DEBUGTff7b72=Ta5d6ff"true"
Tffa657export Te6edf3NOMADFORUM_STORAGE_PATHTff7b72=Ta5d6ff"/tmp/nomadForum_tests"
mkdir Te6edf3$NOMADFORUM_STORAGE_PATH
Tffa657echo Testing functions...
Tffa657cd Tff7b72$(dirname Te6edf3$0Tff7b72)
python3 test_functions.py
Te6edf3TEST_STATUSTff7b72=Te6edf3$?
Tff7b72if Tff7b72[ Te6edf3$TEST_STATUS !Tff7b72= Ta5d6ff"0" Tff7b72]Tb4b4b4; Tff7b72then
Te6edf3FAIL_COUNTTff7b72=Tff7b72$((Te6edf3FAIL_COUNT Tff7b72+ T79c0ff1Tff7b72))
Tff7b72fi
Tffa657echo Creating Tffa657test database
./prepare_test_database.py
Te6edf3TEST_STATUSTff7b72=Te6edf3$?
Tff7b72if Tff7b72[ Te6edf3$TEST_STATUS !Tff7b72= Ta5d6ff"0" Tff7b72]Tb4b4b4; Tff7b72then
Tffa657echo Ta5d6ff"Critical error!"
Tffa657exit T79c0ff1
Tff7b72fi
Tffa657echo Running tests Tff7b72for the pages...
Tff7b72for Tffa657test Tff7b72in ./page_tests/test_*
Tff7b72do
Te6edf3$test
Te6edf3TEST_STATUSTff7b72=Te6edf3$?
Tff7b72if Tff7b72[ Te6edf3$TEST_STATUS !Tff7b72= Ta5d6ff"0" Tff7b72]Tb4b4b4; Tff7b72then
Te6edf3FAIL_COUNTTff7b72=Tff7b72$((Te6edf3FAIL_COUNT Tff7b72+ T79c0ff1Tff7b72))
Tff7b72fi
Tff7b72done
Tffa657cd Tff7b72$(dirname Tff7b72$(Tffa657pwdTff7b72)Tff7b72)
T8b949e# clean up
Tffa657echo Removing Tffa657test environment...
rm -rf /tmp/nomadForum_tests
deactivate
rm -rf ./virtual_environment_nomadForum_tests
rm -rf ./__pycache__
Tffa657echo
Tffa657echo Ta5d6ff'-------------------------------'
Tff7b72if Tff7b72[ Te6edf3$FAIL_COUNT !Tff7b72= Ta5d6ff"0" Tff7b72]Tb4b4b4; Tff7b72then
Tffa657echo Ta5d6ff'███████╗ █████╗ ██╗██╗ '
Tffa657echo Ta5d6ff'██╔════╝██╔══██╗██║██║ '
Tffa657echo Ta5d6ff'█████╗ ███████║██║██║ '
Tffa657echo Ta5d6ff'██╔══╝ ██╔══██║██║██║ '
Tffa657echo Ta5d6ff'██║ ██║ ██║██║███████╗'
Tffa657echo Ta5d6ff'╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝'
Tffa657echo Ta5d6ff'-------------------------------'
Tffa657echo Ta5d6ff"Te6edf3$FAIL_COUNTTa5d6ff test(s) failed. This usually indicates a problem with the code.Ta5d6ff"
Tff7b72else
Tffa657echo Ta5d6ff' ██████╗ ██╗ ██╗'
Tffa657echo Ta5d6ff'██╔═══██╗██║ ██╔╝'
Tffa657echo Ta5d6ff'██║ ██║█████╔╝ '
Tffa657echo Ta5d6ff'██║ ██║██╔═██╗ '
Tffa657echo Ta5d6ff'╚██████╔╝██║ ██╗'
Tffa657echo Ta5d6ff' ╚═════╝ ╚═╝ ╚═╝'
Tffa657echo Ta5d6ff'-------------------------------'
Tffa657echo All tests finished without errors.
Tff7b72fi
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────